const express = require('express')
const route = express.Router()
const advModel = require('../db/model/advModel')
//引入权限校验中间件
const isLoginMiddle = require("../middleware/isLoginMiddle")



route.get('/advList', isLoginMiddle, async (req, res) => {
  try {
    const findResult = await advModel.find({})
    return res.send({
      code: 10000,
      msg: '查询广告成功',
      data: findResult
    })
  } catch (e) {
    console.log('查询广告列表异常' + e.message);
    return res.send({
      code: 10001,
      msg: '查询广告列表异常' + e.message,
      data: null
    })
  }
})

module.exports = route